package com.lenin.omena.shared.domain;

import java.io.Serializable;

import javax.jdo.annotations.Extension;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;


@PersistenceCapable(identityType=IdentityType.APPLICATION)
public class Produce implements Serializable {
	
	//private static final long serialVersionUID = 7440297955003302414L;

    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY, defaultFetchGroup = "true")
    @Extension(vendorName="datanucleus", key="gae.encoded-pk", value="true")
    private String key;

	@Persistent
	private String name;
	
	@Persistent
	private String price;
	
	@Persistent
	private String amount;
	
	public Produce() {
	}
	

	public String getKey() {
		return key;
	}


	public void setKey(String key) {
		this.key = key;
	}


	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	

	public String getAmount() {
		return amount;
	}

	public void setAmount(String amount) {
		this.amount = amount;
	}

	public String getPrice() {
		return price;
	}
	
	public void setPrice(String price) {
		this.price = price;
	}

	public int compareTo(Produce p) {
		return (p == null || p.name == null) ? -1
				: -p.name.compareTo(name);
	}

	@Override
	public boolean equals(Object o) {
		if (o instanceof Produce) {
			return key == ((Produce) o).key;
		}
		return false;
	}
	

}